//
//  VideoPlayer.m
//  RunningMan
//
//  Created by dllo on 16/5/21.
//  Copyright © 2016年 JohnnyB. All rights reserved.
//

#import "VideoPlayer.h"

@implementation VideoPlayer

static VideoPlayer *play = nil;
+(instancetype)shareMySelf{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        play = [[VideoPlayer alloc] init];
    });
    
    
    return play;
    
}
+ (instancetype)allocWithZone:(struct _NSZone *)zone{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        play =
        [super allocWithZone:zone];
    });
    return play;
    
}

- (void)playWithUrl:(NSString *)url {
    
    if (self.currentItem) {
        
        [self replaceCurrentItemWithPlayerItem:self.currentItem];
    }
    
    AVPlayerItem *playerItem = [[AVPlayerItem alloc] initWithURL:[NSURL URLWithString:url]];
    [self replaceCurrentItemWithPlayerItem:playerItem];
}
@end
